Repository navigation
fix(permissions): one allow rule per script, * only at the end (#780) - #781
Conversation
install-claude-permissions.sh wrote Bash(./bin/*.sh:*) and friends. A `*` mixed with the trailing `:*` is matched as a literal prefix: claude doctor 2.1.325 flags each such rule, and a real `claude -p` run was denied both `./bin/status.sh` and `./bin/status.sh --brief` under master's rules, while Bash(./bin/status.sh *) ran both. Now: one space-form rule per script that exists (project bin/ shared, toolkit bin/ by absolute path local), one mx rule per installed mxbuild version (local, `~` and absolute spellings). Old entries go through the existing sidecar prune; --check names them. The prune rebound the allow list, which dropped every addition in the same run; it now edits in place. Project-profile allow rules use the space form; deny/ask are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HXpQSjXefSNicGGqP4aiSC
|
Review: MERGE-AFTER-FIX. The fix is correct and needed, and existing installs migrate cleanly. But it turns a dead allow list into a live one, so an agent can now run Value: Fixes #780 as reported, and I reproduced it. Regression risk:
Correctness:
Context cost: 66271 → 66271 words (measured). Time cost: install/sync check only, Exact fixes required:
Generated by Claude Code |
…ing; --hooks-only --check lists no stale entries Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HXpQSjXefSNicGGqP4aiSC
|
Review fixes pushed in 7ef3f99.
Fixture
Needs a re-review before merge. Generated by Claude Code |
|
Review: MERGE-AFTER-FIX (re-review). The fix commit 7ef3f99 is correct, and all three requested fixes landed. One unprompted path to bare Value: Fixes #780 as reported. The fix commit leaves the five decision-recording scripts and Regression risk:
Correctness: The new T12 assertions test what they claim.
All three ran in a detached worktree. Minor: Context cost: 66271 → 66271 words (measured). Exact fixes required:
Generated by Claude Code |
…missions from PROJECT.md's profile) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HXpQSjXefSNicGGqP4aiSC
|
Review: MERGE. Fix commit 7aeefab is correct: Value: Fixes #780 as reported. 7aeefab adds
T12 builds its rules from the real toolkit Regression risk: The only behaviour change is that
There is no merge conflict with origin/master. Correctness: No bugs. Results in a detached worktree:
Context cost: 66271 → 66271 words (measured). Time cost: none per build row; only install and sync Generated by Claude Code |
…on-rules # Conflicts: # CHANGELOG.md
…stop allowing install-claude-hooks.sh (#782) (#785) Review: MERGE — no ordinary spelling of a state-changing call escapes the ask rules; migration verified on a real #781-shaped install; proven on claude 2.1.325 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HXpQSjXefSNicGGqP4aiSC
Fixes #780
Direct lane
What changed and why (one paragraph):
bin/install-claude-permissions.shwrote allow rules such asBash(./bin/*.sh:*),Bash(~/.mxcli/mxbuild/*/modeler/mx:*)andBash($TOOLKIT_ROOT/bin/*.sh:*). Each one mixes a*with the trailing:*, and Claude Code 2.1.325 does not match such a rule as the installer meant.claude doctorreports each one as "matched as a literal prefix (the * is not expanded) and will likely never match". A realclaude -prun under master's rules was denied both./bin/status.shand./bin/status.sh --brief. That is worse than the issue's reading, which was that only bare calls prompt.The installer now writes one space-form rule per script that exists, with the
*only at the end:settings.json:Bash(./bin/<name>.sh *),Bash(bin/<name>.sh *)andBash(bash bin/<name>.sh *)for each projectbin/*.sh. The exec.sh entries are always present.settings.local.json:Bash(<toolkit>/bin/<name>.sh *)andBash(bash <toolkit>/bin/<name>.sh *)for each toolkit script. Also onemxrule per installed~/.mxcli/mxbuild/<ver>/modeler/mx[.exe], in both the~and the absolute spelling.Bash(./mxcli *),Bash(mxcli *)and the project-profile allow rules (npm install,git add, …) move to the space form. With a single wildcard this is exactly equivalent.Migration:
--check(and sosync-project.sh) now names the entries the next install will remove. That listing alone never changes the exit code.Other changes:
perms["allow"]away from the list the additions were appended to.doctor.shgreps the new"Bash(./bin/exec.sh *)"spelling, so an old install reads "missing the safe-wrapper entries" and gets the re-run hint.Impact
sync-project.sh's existing permission--checkWARN now fires once on every project installed before this change: the new per-script entries are missing untilinstall-harness-permissions.sh <project>is re-run, and the output lists the old entries that the re-run removes. A script installed later, or a new mxbuild version, also shows as missing until the next re-run, the same way any missing entry does today.bin/install-claude-permissions.sh,bin/doctor.sh(one grep string),bin/init-project.sh(comment only) and the fixture. No_common.sh,exec.shorskill-routing.tsvchanges. New reads:<project>/bin/*.sh(producer: init-project/sync-project install frominstall-manifest.shbefore this script runs at init),<toolkit>/bin/*.sh, and$HOME/.mxcli/mxbuild/*/modeler/mx(producer:mxcli setup mxbuild/doctor.sh --install; none installed is fine). Independent of #775: both touchbin/doctor.sh(different lines, which auto-merge) and CHANGELOG (keep both lines).--check0.13 s → 0.16 s, on a project with all 56 project-bin.shinstalled and theprojectprofile (Linux container). Nothing per exec. The sharedsettings.jsonallow list grows 22 → 183 entries (168 script rules) and the local one 2 → 114, which is the issue's accepted cost of about 3 per script.Time cost: per project (install/sync check) · +0.03 s on a Linux container · can force rework: n · offset: removes the permission prompt on every toolkit-script and mx call, and the doctor/startup warning rows
Field evidence (claude 2.1.325, 2026-11-16; the maintainer authorised the model calls and asked for this proof before any fix):
The test used a throwaway project with an executable
bin/status.shthat printsok. Rules were master's installer output, passed through--settings; without it,-pprintsIgnoring 9 permissions.allow entries … this workspace has not been trusted. The new-rules control shows that--settingsis honored. Command:claude -p … --permission-mode default --output-format json --max-turns 3.permission_denials./bin/status.sh./bin/status.sh --briefBash(./bin/status.sh *)./bin/status.shokBash(./bin/status.sh *)./bin/status.sh --briefokclaude doctor(no model call), with the workspace trusted through a scratch HOME:project, re-installed by this branch: no such section. The re-install removed the 19 old entries.No startup warning appeared on stderr in
-pmode. The interactive banner row was not observed, because there is no TTY here.Fixture:
tests/wave2/test-install-claude-permissions.sh. The T1–T6 expectations are updated to the new strings, and a new T12 checks that:*before its final*;./bin/gate-check.sh,bin/status.sh,bash bin/doctor.sh, toolkit scripts by absolute path,mxin both spellings), and./bin/gate-check.shxdoes not;Bash(npm test *)andBash(make *)are kept, and--checknames the old entries beforehand.Results:
origin/masterc3c8a30): PASS=186 FAIL=13Other checks:
Other fixtures that target the changed files:
test-look-hook-cwd.sh9/0 andtest-look-ledger-hook-repair.sh13/0.Not run, checked by inspection:
test-model-stamp.shT8 (refused by the session's auto-mode classifier; the deny list it asserts is unchanged) and thetest-file-bugs.shpermissions check (its Python ran standalone against the new file and exits 0).bin/check-scripts.sh, the leak guard andbin/check-portability.share clean.No client data anywhere in the diff
Size cap: 5 files, ~140 non-fixture lines
Test tier reached: fixture plus a real Claude Code run (the field proof above)
For a changed instrument: the golden input is master's real installer output. Layouts:
.claude/andbin/sit at the project root in both. Platforms: bash 3.2-safe, andmx.exeis included for Git BashFor a new skill: n/a
CHANGELOG.mdline appended, crediting the reportersNew bug entries: n/a
Review: pending independent review
Generated by Claude Code